<?php require_once($_SERVER['DOCUMENT_ROOT']."/defaultconf.mex");
	require_once($GLOBALS['LIB']."/Pr_db/pr_selects.php");
	MYTCONN(); 
	if(isset($_GET['COAG'])) {
		#IF COAG IS INT
		$GET = $GLOBALS['MYT']->db_array($qrOF.$_GET['COAG']);
	} else {
		$DGET = $GLOBALS['MYT']->db_array("DESCRIBE oficcorresp");
		$GET = array();
		for($i=1;$i<=$DGET[0];$i++) {
			$GET[1][$DGET[$i]['Field']] = '';
		}
		$GET[1]['CiuPais'] = 0;
		$GET[1]['Prov_ID'] = 0;
	}
	$_POST['OFIDPais'] = $GET[1]['CiuPais'];
	$_POST['OFIDCiudad'] = $GET[1]['OFIDCiudad'];
	$_POST['OFIDProv'] = $GET[1]['Prov_ID'];
	
	form_pr('coag_edit','','','post');
	echo '<label style="position:absolute;top:10px;left:20px">ID Agencia:</label>';
	mn_field('text','ED','OFId',$GET[1]['OFId'],'','','','" style="position:absolute;top:10px;left:100px" readonly="'); 
	echo '<label style="position:absolute;top:10px;left:400px">Correspondente:</label>';
	mn_field('select','ED','OFCorr',$GET[1]['OFCorr'],$qrActiveCorrespList,'','','" style="position:absolute;top:10px;left:500px'); 
	
	echo '<label style="position:absolute;top:50px;left:20px">Situacao:</label>';
		mn_field('select','ED','OFActiva',$GET[1]['OfActiva'],$qrFlag."23",'','','" style="position:absolute;top:50px;left:100px');
	echo '<label style="position:absolute;top:50px;left:400px">Pais:</label>';
	mn_field('select','ED','OFIDPais',$GET[1]['CiuPais'],$qrCountry,'','','" style="position:absolute;top:50px;left:500px" onchange="
		document.coag_edit.action=\'Modules/FTK9D4D0/Lib/a_geogprov.php\';
		subform(\'coag_edit\',\'CiuProv\');');
	echo '<label style="position:absolute;top:120px;left:20px">Delegacao:</label>';
	mn_field('text','ED','OfDelegacion',$GET[1]['OfDelegacion'],'120','120','','" style="position:absolute;top:120px;left:100px'); 
	echo '<label style="position:absolute;top:75px;left:400px">Regiao:</label>'; 
	echo '<div id="CiuProv" style="position:absolute;top:71px;left:500px">';
	include($GLOBALS['PAD'].'Modules/FTK9D4D0/Lib/a_geogprov.php');
	echo '</div>'; 
	
	echo '<label style="position:absolute;top:100px;left:400px">Cidade:</label>'; 
	echo '<div id="CiuCiudad" style="position:absolute;top:96px;left:500px">';
	include($GLOBALS['PAD'].'Modules/FTK9D4D0/Lib/a_geogcity.php');
	echo '</div>'; 
	echo '<label style="position:absolute;top:150px;left:20px">Endere�o:</label>';
	mn_field('text','ED','OFDIreccion',$GET[1]['OFDIreccion'],'150','120','','" style="position:absolute;top:150px;left:100px'); 
	mn_field('text','ED','OFMasDatos',$GET[1]['OFMasDatos'],'150','120','','" style="position:absolute;top:175px;left:100px'); 
	
	echo '<label style="position:absolute;top:200px;left:100px">Telefone</label>';
	echo '<label style="position:absolute;top:230px;left:100px">Telefone Outro</label>';
	mn_field('text','ED','OFTelefonos1',$GET[1]['OFTelefonos1'],'40','40','','" style="position:absolute;top:200px;left:220px');
	mn_field('text','ED','OFTelefonos2',$GET[1]['OFTelefonos2'],'40','40','','" style="position:absolute;top:230px;left:220px');
	echo '<label style="position:absolute;top:300px;left:100px">Horario Semana:</label>';
	mn_field('text','ED','OfHorSem',$GET[1]['OfHorSem'],'50','50','','" style="position:absolute;top:300px;left:220px');
	echo '<label style="position:absolute;top:330px;left:100px">Horario Sabado:</label>';
	mn_field('text','ED','OfHorSab',$GET[1]['OfHorSab'],'50','50','','" style="position:absolute;top:330px;left:220px');
	echo '<label style="position:absolute;top:360px;left:100px">Horario Domingo:</label>';
	mn_field('text','ED','OfHorDom',$GET[1]['OfHorDom'],'50','50','','" style="position:absolute;top:360px;left:220px');
	echo '<label style="position:absolute;top:390px;left:20px">Observacoes:</label>';
	mn_field('text','ED','OFObs',$GET[1]['OFObs'],'120','120','','" style="position:absolute;top:390px;left:100px'); 
	mn_field('button','ED','OFSubmit','Guardar','','','','" style="height:30px;position:absolute;top:425px;left:100px" onclick="
			document.coag_edit.action=\'_response/rsproxy.php?pr=co_coag\';
			subform(\'coag_edit\',\'rsOF\');'); 
	echo '<div id="rsOF" style="height:30px;position:absolute;top:425px;left:200px"></div>';
	echo '</form>';